function ngdomSoundManager() {
	if (!ngdom.Engine) return;
	this.engine = ngdom.Engine;
	this.sounds = {};
	this.playOnLoad = {};
}
ngdomSoundManager.prototype.load = function (key, filename, options) {
	if (this.playOnLoad[key]) {
		if (!options) options = {};
		options.autostart = true;
		this.playOnLoad[key] = false;
	}
	this.sounds[key] = new ngdom.Engine.initClasses.sound(ngdom.Engine.paths.audio + filename, options);
};
ngdomSoundManager.prototype.play = function (audio) {
	if (ngdom.Engine.enableAudio && typeof(this.sounds[audio]) != 'undefined' && $.isFunction(this.sounds[audio].play))
		this.sounds[audio].play();
	else if (ngdom.Engine.enableAudio)
		this.playOnLoad[audio] = true;
};
ngdomSoundManager.prototype.stop = function (audio) {
	if (ngdom.Engine.enableAudio && typeof(this.sounds[audio]) != 'undefined' && $.isFunction(this.sounds[audio].stop))
		this.sounds[audio].stop();
};
ngdomSoundManager.prototype.fadeIn = function (audio, duration) {
	if (!ngdom.Engine.enableAudio) return;
	if (typeof(audio) == 'undefined' || (!isNaN(audio) && typeof(duration) == 'undefined')) {
		if (this.wasPlaying) {
			duration = audio;
			var that = this;
			$.each(this.wasPlaying, function (index, audio) {
				if (typeof(that.sounds[audio]) != 'undefined' && $.isFunction(that.sounds[audio].fadeIn))
					that.sounds[audio].fadeIn(duration);
			});
			this.wasPlaying = false;
		}
	}
	else {
		if (typeof(this.sounds[audio]) != 'undefined' && $.isFunction(this.sounds[audio].fadeIn))
			this.sounds[audio].fadeIn(duration);
	}
};
ngdomSoundManager.prototype.fadeOut = function (audio, duration, reset) {
	if (!ngdom.Engine.enableAudio) return;
	if (typeof(audio) == 'undefined' || (!isNaN(audio) && typeof(duration) == 'undefined')) {
		duration = audio;
		this.wasPlaying = [];
		var that = this;
		$.each(this.sounds, function (key, audio) {
			if ($.isFunction(audio.fadeOut)) {
				that.wasPlaying[that.wasPlaying.length] = key;
				audio.fadeOut(duration);
			}
		});
	}
	else {
		if (typeof(this.sounds[audio]) != 'undefined' && $.isFunction(this.sounds[audio].fadeOut))
			this.sounds[audio].fadeOut(duration, reset);
	}
};